package com.heima.admin.controller;

import com.heima.admin.annotation.LogModule;
import com.heima.api.wemedia.IWmChannelClient;
import com.heima.model.wemedia.dtos.WmSensitiveDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmSensitive;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/sensitive")
public class AdminSensitiveController {

    @Autowired
    private IWmChannelClient wmChannelClient;
    @DeleteMapping("/del/{id}")
    public ResponseResult deleteSensitiveById(@PathVariable("id") Integer id){
       return wmChannelClient.deletaById(id);
    }
    @PostMapping("/list")
    public ResponseResult listSensitive(@RequestBody WmSensitiveDto dto){
        return wmChannelClient.list(dto);
    }
    @PostMapping("save")
    @LogModule("增加内容敏感词")
    public ResponseResult saveSensitive(@RequestBody WmSensitive sensitives){
        return wmChannelClient.save(sensitives);
    }
    @PostMapping("update")
    @LogModule("修改内容敏感词")
    public ResponseResult updateSensitive(@RequestBody WmSensitive sensitives){
        return wmChannelClient.update(sensitives);
    }
}
